package 兑换零钱;

import java.util.Arrays;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int ami = in.nextInt();
        int[] f = new int[ami + 1];
        Arrays.fill(f, 0x3f3f3f3f);
        f[0] = 0;
        for (int i = 1; i <= n; i++) {
            int x = in.nextInt();
            for (int j = x; j <= ami; j++) {
                f[j] = Math.min(f[j], f[j - x] + 1);
            }
        }
        if (f[ami] == 0x3f3f3f3f) {
            System.out.println(-1);
        } else {
            System.out.println(f[ami]);
        }
    }
}
